//防抖

// 使用防抖动函数来限制搜索的频率
export const debounce = (func, wait) => {
    let timeout;
    return function(...args) {
      clearTimeout(timeout);
      timeout = setTimeout(() => func.apply(this, args), wait);
    };
  

}
// 节流函数，用于控制函数调用频率
export const throttle = (func, wait) => {
    let lastTime = 0;
    return function (...args) {
      const now = new Date().getTime();
      if (now - lastTime >= wait) {
        func.apply(this, args);
        lastTime = now;
      }
    };


}
